﻿using System;
using System.Linq.Expressions;

namespace TSharp.Core.TestUtil.Fluent
{
    public class FluentMoq<T> where T : class
    {
        private readonly Moq.Mock<T> mocker;

        public FluentMoq(Moq.MockBehavior behavior, params object[] args)
        {
            mocker = new Moq.Mock<T>(behavior, args);
        }

        public FluentMoq<T> Returns<TResult>(Expression<Func<T, TResult>> expression, TResult result)
        {
            mocker.Setup<TResult>(expression).Returns(result);
            return this;
        }
        public FluentMoq<T> Callback(Expression<Action<T>> expression, Action<T> action)
        {
            mocker.Setup(expression).Callback(action);
            return this;
        }
        public FluentMoq<T> SetupGet<TProperty>(Expression<Func<T, TProperty>> expression, TProperty value)
        {
            mocker.SetupGet<TProperty>(expression).Returns(value);
            return this;
        }
        public FluentMoq<T> SetupGet<TProperty>(Func<bool> func, TProperty value)
        {

            return this;
        }
    }
}